package com.itheima.网络编程.网络编程基础编程.tcp;

import java.io.IOException;
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class tcp接收数据 {
    public static void main(String[] args) throws IOException {
        tcpInput1();

    }

    public static void tcpInput1() throws IOException {
        ServerSocket ss = new ServerSocket(11000);
        ;
        while (true) {
            System.out.println("等待接收客户端发送的数据：");
            Socket accept = ss.accept();
            InputStream inputStream = accept.getInputStream();
            byte[] bys = new byte[1024 * 1024];
            int len = inputStream.read(bys);
            String s = new String(bys, 0, len);
            System.out.println("服务端接收到的消息是： " + s);
            inputStream.close();
//            ss.close();
//            accept.close();
        }


    }
}
